home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 1996 May & June / Amiga-CD 1996 #5-6.iso / demos / finaldata / fdmacros / standardlabels < prev   
Text File  |  1996-03-22  |  7KB  |  155 lines

  1. /* StandardLabels - Prints labels from FinalData's STANDARD Name/Address database   */
  2. /* SoftWood, Inc. - by Dick Skraly - June, 1994                                     */
  3. /* Use of this macros is strictly at the user's risk                                */
  4. /* ASSUMES: - Current window is a "STANDARD" label database                         */
  5. /*             (ie created by 'Build Standard Name-Address' AREXX macro             */
  6. /*          - The six column names have not changed                                 */
  7. /*          - User is familiar with AREXX - NO TECHNICAL SUPPORT FOR AREXX          */
  8. /*          - executable from FinalData only (not from CLI)                         */
  9. /*          - Labels are 3.5" by 15/16" (OR  35 char by 6 lines - 1 across)         */
  10. /*                         7" by 15/16" (OR  70 char by 6 lines - 2 across)         */
  11. /*                      10.5" by 15/16" (OR 105 char by 6 lines - 3 across)         */
  12. /*                        14" by 15/16" (OR 140 char by 6 lines - 4 across)         */
  13. /* EXIT RC: - 0 = OK, no errors                                                     */
  14. /*          - 1 = ERROR, not a STANDARD Name/Address database                       */
  15. /*          - 2 = ERROR, the Column names are not STANDARD                          */
  16. /*          - 3 = ERROR, invalid entry for number across requestor                  */
  17. /*          - 4 = ERROR, not called from FinalData                                  */
  18. /*          - 5 = ERROR, user cancel                                                */
  19. /* $VER: FDStandardLabels 1.1 (22.7.94)                                             */
  20.  
  21.  
  22. /* --------------------------------------------------------------------------- */
  23. /* ----- Variables that you change for printing STANDARD database labels ----- */
  24. /* --------------------------------------------------------------------------- */
  25.    MacroLines = '6'        /* defines the height (in lines) of the label                                                   */
  26.    MacroAcross = '1'       /* defines the number of horizontal labels across 1 page (default only - may be changed below)  */
  27.    MacroCopies = '1'       /* defines the number of label sets to print                                                    */
  28.    MacroLabelWidth = '35'  /* defines the physical width (in characters -or- 3.5") of each label                           */
  29.    MacroPrintWidth = '33'  /* defines the printing width (in characters -or- 3.3") of each label                           */
  30.    MacroPerpage = 'One'    /* defines whether the label is a page ('One') or a page has multiple labels ('Multiple')       */
  31.    MacroDown = '1'         /* defines the number of vertical labels (only if MacroPerpage is 'Multiple'                    */
  32.    MacroSkip = '0'         /* defines the number of lines to skip after 1 page (only if MacroPerpage is 'Multiple'         */
  33.    MacroColName.1 = 'First Name'
  34.    MacroColName.2 = 'Last Name'
  35.    MacroColName.3 = 'Address'
  36.    MacroColName.4 = 'City'
  37.    MacroColName.5 = 'State'
  38.    MacroColName.6 = 'Zip Code'
  39.  
  40.  
  41. /* ----- Initialization and make sure called from FinalData -----*/
  42.    Options Results
  43.    HOST=ADDRESS()
  44.    ADDRESS VALUE HOST
  45.    if LEFT(HOST,7) ~== 'FINALD.' then EXIT 4
  46.  
  47.     SelectOff
  48.  
  49. /* ----- Init variables ----- */
  50.    NumRows
  51.    AllRows = Result
  52.    NumColumns
  53.    AllCols = Result
  54.    if (AllCols ~= 6) then AllRows = 0  /* Forces error below */
  55.    if (AllRows == 0) then do
  56.       Showmessage 1 0 '"STANDARD LABELS - ERROR 1:" "This is not a STANDARD Name/Address database," "-or- the database is empty." "Abort" "" ""'
  57.       exit 1
  58.    end
  59.  
  60.  
  61. /* ----- Find Column Names ----- */
  62.    x=0
  63.    do i=1 to AllCols
  64.       GetColumnName POSITION i
  65.       select
  66.          when Result == MacroColName.1 then x = x + 1
  67.          when Result == MacroColName.2 then do
  68.             x = x + 10
  69.             LastNameCol=i
  70.          end
  71.          when Result == MacroColName.3 then x = x + 100
  72.          when Result == MacroColName.4 then x = x + 1000
  73.          when Result == MacroColName.5 then x = x + 10000
  74.          when Result == MacroColName.6 then do
  75.             x = x + 100000
  76.             ZipCodeCol=i
  77.          end
  78.          otherwise NOP
  79.       end
  80.    end
  81.    if x ~= '111111' then do
  82.       Showmessage 1 0 '"ERROR: 2" "The Column names are not STANDARD!" "" "Abort" "" ""'
  83.       exit 2
  84.    end
  85.  
  86.  
  87. /* ----- Ask for labels across ----- */
  88.    RequestText '"STANDARD LABELS:" "How many labels ACROSS (1-4)?" 'MacroAcross''
  89.    if RC=5 then exit 5
  90.    Result = STRIP(Result)
  91.    select
  92.       when Result='1' then MacroAcross=1
  93.       when Result='2' then MacroAcross=2
  94.       when Result='3' then MacroAcross=3
  95.       when Result='4' then MacroAcross=4
  96.       otherwise do
  97.          Showmessage 1 0 '"STANDARD LABELS - ERROR 2:" "Not a valid entry," "Valid entries are 1 thru 4 only." "Abort" "" ""'
  98.          exit 3
  99.       end
  100.    end
  101.    if MacroAcross > 1 then MacroPerpage='Multiple'
  102.  
  103.    /* -----  P R I N T   P R E F S  ----- */
  104.    GetPrintPrefs QUALITY PITCH SPACING DEVICE PAPERFEED FILENAME
  105.    PARSE VAR Result OldQuality OldPitch OldSpacing OldDevice OldPaperFeed OldFileName
  106.    NewPitch = 'Pica'
  107.    NewSpacing = 'Six'
  108.    NewDevice = 'Printer'
  109.    SetPrintPrefs QUALITY OldQuality PITCH NewPitch SPACING NewSpacing DEVICE NewDevice PAPERFEED OldPaperFeed FILENAME OldFileName
  110.  
  111.  
  112.    /* -----  L A B E L   P R E F S  ----- */
  113.    GetLabelPrefs  COPIES LABELWIDTH LABELHEIGHT LABELSPERPAGE LABELSACROSS LABELSDOWN PRINTWIDTH SKIP
  114.    PARSE VAR Result OldCopies OldLabelwidth OldLabelheight OldLabelsperpage OldLabelsacross OldLabelsdown OldPrintwidth OldSkip
  115.    ClearLabel
  116.    SetLabelPrefs COPIES MacroCopies PRINTWIDTH MacroPrintWidth LABELWIDTH MacroLabelWidth LABELHEIGHT MacroLines LABELSPERPAGE MacroPerpage LABELSACROSS MacroAcross LABELSDOWN MacroDown SKIP MacroSkip
  117.    /* ----- Set Label defines ----- */
  118.    SetLabelDef 5 1 1 Space             /* 5 = First Name Col.  */
  119.    SetLabelDef 4 1 2 None              /* 4 = Last Name Col.   */
  120.    SetLabelDef 3 2 1 None              /* 3 = Address Col.     */
  121.    SetLabelDef 2 3 1 CommaSpace        /* 2 = City Col.        */
  122.    SetLabelDef 1 3 2 Space             /* 1 = STate Col.       */
  123.    SetLabelDef 0 3 3 None              /* 0 = Zip Code         */
  124.  
  125.  
  126.    /* ----- SORT? ----- */
  127.    Showmessage 1 0 '"    S O R T  by:" "Zip Code, Last Name?" "" "Yes" "No" "Abort"'
  128.    if Result = 3 then exit 0
  129.    if Result = 1 then do
  130.       if AllRows > 1 then do
  131.          ClearSort
  132.          AddColumnToSort ZipCodeCol
  133.          AddColumnToSort LastNameCol
  134.          SortRows
  135.       end
  136.    end
  137.  
  138.  
  139.    /* ----- P r i n t ----- */
  140.  
  141. /**************************************************************/
  142. /**************************************************************/
  143. /**************************************************************/
  144.    PrintLabels
  145. /**************************************************************/
  146. /**************************************************************/
  147. /**************************************************************/
  148.  
  149.    /* ----- Reset Prefs back to prior settings ----- */
  150.  
  151.    SetLabelPrefs COPIES OldCopies PRINTWIDTH OldPrintwidth LABELWIDTH OldLabelwidth LABELHEIGHT OldLabelheight LABELSPERPAGE OldLabelsperpage LABELSACROSS OldLabelsacross LABELSDOWN OldLabelsdown SKIP OldSkip
  152.    SetPrintPrefs QUALITY OldQuality PITCH OldPitch SPACING OldSpacing DEVICE OldDevice PAPERFEED OldPaperFeed FILENAME OldFileName
  153.  
  154. exit RC /****** end of StandardLabel ********************/
  155.